
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Leitor {

	public List<Request> lerOperacoes(File arquivo) throws NumberFormatException {
		File f = arquivo;

		ArrayList<Request> lista = new ArrayList<Request>();

		try {
			BufferedReader in = new BufferedReader(new FileReader(f));
			String line;
			while ((line = in.readLine()) != null) {
				String ops[] = line.split("-");
				for (int i = 0; i < ops.length; i++) {
					String op = ops[i];
					char operacao = op.charAt(op.length() - 1);
					op = op.substring(0, op.length() - 1);
					int pagina = Integer.parseInt(String.valueOf(op));
					lista.add(new Request(pagina, operacao));
				}
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

		return lista;
	}

}